package com.practice.mybpapi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.practice.mybpapi.domain.po.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    /**
     * 扣减余额
     *
     * @param id  用户id
     * @param money 金额
     */
    @Update("update user set balance = balance - #{money} where id = #{id}")
    void deductBalance(@Param("id") Long id, @Param("money") Integer money);
}
